package yifeng.program;

import java.util.ArrayList;
import java.util.List;

/**
 * 最长上升子序列
 * @author pengyifeng
 *
 */
public class LongestAscendingSequence {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int[] a = {3, 9, 22, 10, 33, 5, 11, 12, 13};
		
		
		System.out.println(getXulie(a));
	}
	
	
	
	
	
	public static int getXulie(int[] a){
		
		int[] max = new int[a.length];
		
		int i,j;
		for(i = 0; i < a.length; i++){
			max[i] = 1;
			for(j = 0; j < i; j++){
				if((max[j] >= max[i]) && a[j] < a[i])
					max[i] = max[j] + 1;
			}
		}
		
		int result = 0;
		for(int m : max){
			if(m > result)
				result = m;
		}
		
		return result;
	} 

	
	
	
	
	
	
}








